package ofc4j.util;

import ofc4j.model.axis.Label.Rotation;

import com.thoughtworks.xstream.converters.SingleValueConverter;

public class RotationConverter implements SingleValueConverter {
    @Override
    public Object fromString(String s) {
        return Rotation.valueOf(s.toUpperCase());
    }

    @Override
    public String toString(Object o) {
        return o.toString();
    }

    @Override
    @SuppressWarnings("unchecked")
    public boolean canConvert(Class c) {
        return Rotation.class.isAssignableFrom(c);
    }
}
